//
//  Info.m
//  Vacations
//
//  Created by User-23 on 10/31/14.
//  Copyright (c) 2014 TrainingCamp. All rights reserved.
//

#import "Info.h"

@interface Info ()

@property NSMutableArray* dataInfo;
@property NSMutableArray* location;


@end


@implementation Info

- (instancetype)initForInfo
{
    self = [super init];
    if (self) {
        self.dataInfo = [[NSMutableArray alloc]init];
    }
    return self;
}

- (instancetype)initForLocation
{
    self = [super init];
    if (self) {
        self.location = [[NSMutableArray alloc]init];
    }
    return self;
}


// add detail information for vacation place in array
-(void) addInfo:(NSString*) info
{
    NSString *infoFromFile = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]pathForResource: info ofType: @"txt"] encoding:NSUTF8StringEncoding error:NULL];
    [self.dataInfo addObject:infoFromFile];
}

// get detail information for vacation place from array with index
-(NSString*) backInfo:(NSInteger)index
{
    return [self.dataInfo objectAtIndex:index];
}

// add location information for vacation place in array
-(void) addLocationInfo:(NSString*) location
{
    [self.location addObject:location];
}

// get location information for vacation place from array with index
-(NSString*) backLocationInfo:(NSInteger)index
{
    return [self.location objectAtIndex:index];
}

-(NSArray*) backAllInfo
{
    return self.dataInfo;
}
@end
